<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            padding: 70px;
            border: 10px solid #000;
        }

        header {
            height: 10000px;
        }
    </style>
</head>

<body>
    <div>
        这是div的内容
    </div>
    <header></header>
    <script>
        var div = document.querySelector("div");
        console.log(div.offsetWidth);//360  content+border+padding
        console.log(div.offsetHeight);//360

        console.log(div.clientWidth); //340 content + padding
        console.log(div.clientHeight);

        console.log(div.scrollWidth); //340 content + padding
        console.log(div.scrollHeight);

        // console.log(div.width);
        // console.log(div.style.width);


        console.log(div.getBoundingClientRect()); //{width,}


        var body = document.body;//获取body
        var html = document.documentElement; //获取hmtl

        console.log(html.offsetHeight);//1376  //文档的高度
        console.log(html.clientHeight);//821  //浏览器视图的高度
        console.log(html.offsetHeight);//1360
        console.log(html.clientHeight);//1360


        console.log(window.innerwidth);//浏览器视图窗口的宽
        console.log(window.innerheight);//浏览器视图窗口的高度


        console.log(window.screen.width);//获取屏幕的大小
        console.log(window.screen.height);







    </script>
</body>

</html>